﻿using Microsoft.AspNetCore.Mvc;
using ZingBlog.Domain.Entities;
using ZingBlog.Dto;
using ZingBlog.IService;
using ZingBlog.Web.Areas.Admin.Controllers;

namespace ZingBlog.Web.Areas.Blog.Controllers
{
    [Area("Blog")]
    public class QQUserController : BaseController
    {
        public IQQUserService qqUserService { get; set; }
        // GET: Blog/QQUser
        public override ActionResult Index(int? Id)
        {
            base.Index(Id);
            return View();
        }
        [HttpGet]
        public JsonResult List(QQUserEntity filter, PageInfo pageInfo)
        {
            var result = qqUserService.GetListByFilter(filter, pageInfo);
            return Json(result);
        }
        public ActionResult Detail(int Id)
        {
            var model = qqUserService.ReadEntity(Id);
            return View(model);
        }
        [HttpPost]
        public ActionResult Delete(int Id)
        {
            var result = qqUserService.DeleteEntity(Id) ? SuccessTip() : ErrorTip();
            return Json(result);
        }
        public ActionResult Edit(int id)
        {
            var model = qqUserService.ReadEntity(id);
            return View(model);
        }
        [HttpPost]
        public ActionResult Edit(QQUserEntity model)
        {
            var result = qqUserService.UpdateEntity(model) ? SuccessTip() : ErrorTip();
            return Json(result);
        }
    }
}